﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NearForums.DataAccess;

namespace NearForums.Services
{
    public class AskAnswersService:IAskAnswersService
    {
        private readonly IAskAnswersDataAccess _dataAccess;

        public AskAnswersService(IAskAnswersDataAccess dataAccess)
        {
            _dataAccess = dataAccess;
        }

        public void Add(Answers answer, int questionID, int userId)
        {
            answer.ValidateFields();

            _dataAccess.Add(answer, questionID, userId);
        }

        public void Delete(int answerID)
        {
            _dataAccess.Delete(answerID);
        }

        public List<Answers> GetAnswersByQuestion(int questionID)
        {
            return _dataAccess.GetAnswersByQuestion(questionID);
        }

        public void UpdateAnswerStatus(int answerID, int vote, Boolean isBest)
        {
            _dataAccess.UpdateAnswerStatus(answerID, vote, isBest);
        }
    }
}
